<?php

namespace app\common\model\plus\discount;

use app\common\model\BaseModel;
use app\common\model\plus\discount\DiscountGitProduct;
/**
 * 参与记录模型
 */
class DiscountGitOrder extends BaseModel
{
    protected $name = 'discount_gift_order';
    protected $pk = 'gift_order_id';
    //附加字段
    protected $append = [];


    public static function createData($data)
    {
        $model = new static();
        $data['app_id'] = self::$app_id;
        $model -> save($data);
    }

    public function giftProduct()
    {
        return $this->hasOne(DiscountGitProduct::class, 'gift_product_id', 'gift_product_id');
    }

    public function file()
    {
        return $this->belongsTo('app\\common\\model\\file\\UploadFile', 'image_id', 'file_id');
    }

}